package com.example.zlx.service.impl;

import com.example.zlx.entity.Technology;
import com.example.zlx.repository.TechnologyMapper;
import com.example.zlx.service.TechnologyService;
import com.example.zlx.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TechnologyServiceImpl implements TechnologyService {

    @Autowired
    private TechnologyMapper technologyMapper;

    //通过id获取相应的水电工
    @Override
    public ServerResponse<Technology> getPlumberById(Integer id) {
        Technology  technologyInfo=technologyMapper.findOne(id);
        if(technologyInfo==null){
            return ServerResponse.createByErrorMessage("没有相应的id");
        }
        return ServerResponse.createBySuccess("查找成功",technologyInfo);
    }

    @Override
    public ServerResponse list() {
        List<Technology> list= technologyMapper.findAll();
        return ServerResponse.createBySuccess(list);
    }


}
